/**
 * @(#)ProcessAuthorityVo.java 2009-12-10
 *   
 * Copyright  (c) 2009-2010 Wilmar IT Service,  Inc.   
 * All  rights  reserved.   
 * TODO
 */

package com.wilmar.process.entity.vo;

import java.io.Serializable;
import java.text.SimpleDateFormat;

import com.wilmar.process.core.ProcessSystemDeclareKeys;
import com.wilmar.process.entity.ProcessAuthority;
import com.wilmar.process.enumerate.EnumProcessAuthorityType;

/**
 * @author asus Email:zhoulibo_java@msn.cn
 * @version 1.0.0
 */
public class ProcessAuthorityVO extends AbstractValueObject implements
		Serializable {

	/**
	 * @serialField
	 */
	private static final long serialVersionUID = 3453580497839448249L;

	private String processDefinitionKey;
	private String outerSystem;
	private String organizationCode;
	private String organizationName;
	private String roleCode;
	private String roleName;
	private EnumProcessAuthorityType authorizeType;
	private String authorizeTypeName;
	private String createPersion;
	private String createTime;

	public ProcessAuthorityVO(ProcessAuthority processAuthority) {
		SimpleDateFormat sdf = new SimpleDateFormat(
				ProcessSystemDeclareKeys.SYSTEM_LONG_DATE_FORMAT
						+ ProcessSystemDeclareKeys.SPACE
						+ ProcessSystemDeclareKeys.SYSTEM_LONG_TIME_FORMAT);
		this.processDefinitionKey = processAuthority.getProcessDefinitionKey();
		this.outerSystem = processAuthority.getOuterSystem();
		this.organizationCode = processAuthority.getOrganizationCode();
		this.roleCode = processAuthority.getRoleCode();
		this.authorizeType = processAuthority.getAuthorizeType();
		this.createPersion = processAuthority.getCreatePerson();
		if (processAuthority.getCreateTime() != null) {
			this.createTime = sdf.format(processAuthority.getCreateTime());
		}
		this.organizationName = processAuthority.getOrganizationName();
		this.roleName = processAuthority.getRoleName();
		if (this.authorizeType
				.equals(EnumProcessAuthorityType.PROCESS_SYSTEM_DEFINITION_AUTHORITY_TYPE_BOTH)) {
			authorizeTypeName = "BOTH";
		} else if (this.authorizeType
				.equals(EnumProcessAuthorityType.PROCESS_SYSTEM_DEFINITION_AUTHORITY_TYPE_ORGANIZATION)) {
			authorizeTypeName = "ORGANIZATION";
		} else if (this.authorizeType
				.equals(EnumProcessAuthorityType.PROCESS_SYSTEM_DEFINITION_AUTHORITY_TYPE_ROLE)) {
			authorizeTypeName = "ROLE";
		}
	}

	public String getProcessDefinitionKey() {
		return processDefinitionKey;
	}

	public void setProcessDefinitionKey(String processDefinitionKey) {
		this.processDefinitionKey = processDefinitionKey;
	}

	public String getOuterSystem() {
		return outerSystem;
	}

	public void setOuterSystem(String outerSystem) {
		this.outerSystem = outerSystem;
	}

	public String getOrganizationCode() {
		return organizationCode;
	}

	public void setOrganizationCode(String organizationCode) {
		this.organizationCode = organizationCode;
	}

	public String getOrganizationName() {
		return organizationName;
	}

	public void setOrganizationName(String organizationName) {
		this.organizationName = organizationName;
	}

	public String getRoleCode() {
		return roleCode;
	}

	public void setRoleCode(String roleCode) {
		this.roleCode = roleCode;
	}

	public String getRoleName() {
		return roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public EnumProcessAuthorityType getAuthorizeType() {
		return authorizeType;
	}

	public void setAuthorizeType(EnumProcessAuthorityType authorizeType) {
		this.authorizeType = authorizeType;
	}

	public String getCreatePersion() {
		return createPersion;
	}

	public void setCreatePersion(String createPersion) {
		this.createPersion = createPersion;
	}

	public String getCreateTime() {
		return createTime;
	}

	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}

	public String getAuthorizeTypeName() {
		return authorizeTypeName;
	}

	public void setAuthorizeTypeName(String authorizeTypeName) {
		this.authorizeTypeName = authorizeTypeName;
	}

}
